<?php
/**
 * check whether the $gfcid is registered
 * if it is registered, fetch the username and password and login
 * else register first and login 
 */
define('NOROBOT', TRUE);
define('CURSCRIPT', 'GFCauth');
require_once './include/common.inc.php';
require_once './plugins/gfc/common.php';
require_once './plugins/gfc/discuz.func.php';
$profile = getGFCProfile();
if (!$profile) {
  showmessage('undefined_action');
} else {
  if ($discuz_uid) {
    showmessage('login_succeed', $indexname);
  } else {
    $gfcid = $profile['id'];
    $status = GFCLogin($gfcid);
    if ($status) {
      setcookie("gfcupdateprofilepre",1);
      showmessage('login_succeed', dreferer());
    } else {
      showmessage('login_invalid', dreferer());
    }
  }
}
?>